
Random number generator

C0/062E:	DA      	PHX 			(from C0/0EDB, C0/0EFD, C0/7B0C, C0/7B19, C0/7BB1, C0/B271)
C0/062F:	EE6D1F  	INC $1F6D
C0/0632:	AD6D1F  	LDA $1F6D
C0/0635:	AA      	TAX 
C0/0636:	22B0D6C0	JSL $C0D6B0
C0/063A:	FA      	PLX 
C0/063B:	60      	RTS



Make a random number, or at least as random as possible

C0/D6B0:	08      	PHP            (wherever the game does an LDA $C0FD00,X was replaced with JSL $C0D6B0)
C0/D6B1:	E220    	SEP #$20
C0/D6B3:	BF00FDC0	LDA $C0FD00,X  (get a number from our "random" table)
C0/D6B7:	8D4314  	STA $1443      (one of our seeds)
C0/D6BA:	BF01FDC0	LDA $C0FD01,X  (and again...)
C0/D6BE:	8D4114  	STA $1441      (one of our seeds)
C0/D6C1:	AD4014  	LDA $1440      (get the frame count)
C0/D6C4:	8D4214  	STA $1442      (our final seed)
C0/D6C7:	AD4314  	LDA $1443
C0/D6CA:	8D4414  	STA $1444
C0/D6CD:	AD4214  	LDA $1442
C0/D6D0:	8D4314  	STA $1443
C0/D6D3:	AD4114  	LDA $1441
C0/D6D6:	8D4214  	STA $1442
C0/D6D9:	CD4314  	CMP $1443
C0/D6DC:	3003    	BMI $D6E1
C0/D6DE:	AD4314  	LDA $1443
C0/D6E1:	18      	CLC
C0/D6E2:	6D4414  	ADC $1444
C0/D6E5:	8D4114  	STA $1441
C0/D6E8:	28      	PLP
C0/D6E9:	6B      	RTL

C0/D6EA:	EE4014  	INC $1440      (increment the frame counter, from C0/6879)
C0/D6ED:	9C0C42  	STZ $420C      (executes once per frame while on the world map)
C0/D6F0:	60      	RTS

C0/D6F1:	EE4014  	INC $1440      (increment the frame counter, from C0/BB32)
C0/D6F4:	ADD11D  	LDA $1DD1      (executes once per frame while in the menu)
C0/D6F7:	60      	RTS

C0/D6F8:	EE4014  	INC $1440      (increment the frame counter, from C0/C17A)
C0/D6FB:	AD641F  	LDA $1F64      (executes once per frame while in battle)
C0/D6FE:	60      	RTS

C0/D6FF:	EE4014  	INC $1440      (increment the frame counter, from C0/C331)
C0/D702:	AD8E07  	LDA $078E      (executes once per frame in non-world maps, at least it seems so)
C0/D705:	60      	RTS
